package com.zuxia.action;

import java.io.IOException;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.zuxia.iservices.PartstypeinfoServicesI;
import com.zuxia.po.Partstypeinfo;

public class PartstypeinfoAction extends BaseAction{
	
		private PartstypeinfoServicesI partstypeinfoServices;
		
		
		public PartstypeinfoServicesI getPartstypeinfoServices() {
			return partstypeinfoServices;
		}


		public void setPartstypeinfoServices(
				PartstypeinfoServicesI partstypeinfoServices) {
			this.partstypeinfoServices = partstypeinfoServices;
		}


		//查询配件类型信息
		public void findAll(){
			System.out.println("查询所有配件类型");
			List<Partstypeinfo> list=partstypeinfoServices.findAll();
			if (list!=null) {
				SimplePropertyPreFilter filter = new SimplePropertyPreFilter(Partstypeinfo.class, "ptiid","ptitypeName");
				String json = JSON.toJSONString(list,filter,SerializerFeature.DisableCircularReferenceDetect);
				System.out.println(list);
				try {
					getResponse().getWriter().print(json);
					System.err.println("查询到的配件类型json字符串如下！"+json);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
}
